<div class="fm-content">
  <!-- 最上面标题栏 -->
  <div class="title">
    <i nz-icon [type]="'desktop'"></i>
    &nbsp;&nbsp;行政监管数据
  </div>
  <!-- 内容 -->
  <div class="work">

    <!-- 查询框 -->
    <div class="top">
      <!-- first-input -->
      <nz-select class="fm-input first-input" (nzOpenChange)="regulatoryAuthorityDic.load('0')"
        [(ngModel)]="fs.queryObject['airport:=']" [nzPlaceHolder]="'所属机场'">
        <nz-option *ngFor="let option of regulatoryAuthorityDic.datas" [nzLabel]="option.display" [nzValue]="option.id">
        </nz-option>
        <nz-option *ngIf="regulatoryAuthorityDic.isLoading" nzDisabled nzCustomContent>
          <i nz-icon type="loading" class="loading-icon"></i>加载中...
        </nz-option>
      </nz-select>
      <nz-button-group>
        <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
        <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
      </nz-button-group>
      <div class="tool-right">
        <nz-button-group>
          <button *ngIf="ss.mi.sa || ss.mi.xzjgxz" nz-button [nzType]="'primary'" (click)="addRow()">新增</button>
          <!-- <button nz-button (click)="fs.editRow()">编辑</button> -->
          <button *ngIf="ss.mi.sa || ss.mi.xzjgsc" nz-popconfirm nzTitle="确认删除选择项?" (nzOnConfirm)="fs.delEntitys()" nzPlacement="bottomRight"
            nz-button>删除</button>
          <a nz-button href="assets/images/行政监管.xls" download="行政监管.xls">模板下载</a>
          <button nz-button (click)="fs.export('xjmh_xzjg.html', '行政监管.xls')">导出</button>
          <nz-upload nzAction="{{ fs.getExcelUploadUrl() }}" [nzLimit]="1" [nzHeaders]="ffs.fileHeaders"
                     [nzFilter]="fs.excelFilters" [nzAccept]="'.xls,.xlsx'" (nzChange)="excelHandleChange($event)">
            <button *ngIf="ss.mi.sa || ss.mi.xzjgxz" nz-button>导入</button>
          </nz-upload>
        </nz-button-group>
      </div>
    </div>

    <!-- 右则样表单主体 -->
    <div class="work-content">
      <div class="table">
        <nz-table nzSize="middle" nzShowSizeChanger [nzPageSizeOptions]='[ 10, 15, 20, 30, 40, 50 ]'
          [nzFrontPagination]="false" [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing"
          [nzTotal]="fs.rowsCount" [(nzPageIndex)]="fs.pageIndex" [(nzPageSize)]="fs.pageSize"
          (nzPageIndexChange)="fs.loadData()" (nzPageSizeChange)="fs.loadData(true)">
          <thead>
            <tr>
              <th nzShowCheckbox [(nzChecked)]="fs.allChecked" [nzIndeterminate]="fs.indeterminate"
                (nzCheckedChange)="fs.checkAll($event)"></th>
              <th nzWidth="19%">所属监管局</th>
              <th nzWidth="19%">开展民航行政安全检查(次)</th>
              <th nzWidth="19%">发现安全隐患(个)</th>
              <th nzWidth="19%">下发整改通知书(份)</th>
              <th nzWidth="19%">工作时间</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let data of fs.datas">
              <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="fs.refreshCheckStatus()">
              </td>
              <!-- <td><span (click)="fs.editRow(data)" class="form-edit"></span></td> -->
              <td><span (click)="fs.editRow(data)" class="form-edit">{{data.airportName}}</span></td>
              <td>{{data.administrationcheck === null ? 0 : data.administrationcheck}}</td>
              <td>{{data.hidedanger === null ? 0 : data.hidedanger}}</td>
              <td>{{data.handnoticebook === null ? 0 : data.handnoticebook}}</td>
              <td>{{data.temporaryTime | date:'yyyy-MM-dd'}}</td>
            </tr>
          </tbody>
        </nz-table>
      </div>
    </div>

    <nz-modal nzWidth='830' nzTitle="编辑" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="fs.isEditVisible"
      (nzOnCancel)="fs.closeEdit()">
      <form nz-form [nzLayout]="'inline'">
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">所属监管局</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="!fs.er.airport?'error':'success'" nzHasFeedback>
                <nz-select class="fm-input" [(ngModel)]="fs.er.airport" name="airport" [disabled]="fs.er.airport" >
                  <nz-option *ngFor="let option of regulatoryAuthorityDic.datas" [nzLabel]="option.display" [nzValue]="option.id">
                  </nz-option>
                  <nz-option *ngIf="regulatoryAuthorityDic.isLoading" nzDisabled nzCustomContent>
                    <i nz-icon type="loading" class="loading-icon"></i>加载中...
                  </nz-option>
                </nz-select>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">民航行政安全检查</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="administrationcheck.invalid?'error':'success'"
                nzHasFeedback>
                <nz-input-number [(ngModel)]="fs.er.administrationcheck" name="administrationcheck" required
                  #administrationcheck="ngModel" [nzMin]="0"  [nzStep]="1" class="form-control">
                </nz-input-number>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">发现安全隐患</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="hidedanger.invalid?'error':'success'"
                nzHasFeedback>
                <nz-input-number [(ngModel)]="fs.er.hidedanger" name="hidedanger" required #hidedanger="ngModel"
                  [nzMin]="0"  [nzStep]="1" class="form-control">
                </nz-input-number>
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">下发整改通知书</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="handnoticebook.invalid?'error':'success'"
                nzHasFeedback>
                <nz-input-number [(ngModel)]="fs.er.handnoticebook" name="handnoticebook" required
                  #handnoticebook="ngModel" [nzMin]="0"  [nzStep]="1" class="form-control">
                </nz-input-number>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>

        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">工作日期</nz-form-label>
              <nz-form-control class="form-control" [nzValidateStatus]="temporaryTime.invalid?'error':'success'"
                               nzHasFeedback>
                <nz-date-picker class="fm-input first-input" name="temporaryTime" required
                                [(ngModel)]="fs.er.temporaryTime" #temporaryTime="ngModel"
                                name="selectDate"></nz-date-picker>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24" class="form-button-align">
            <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
            <button *ngIf="ss.mi.sa || ss.mi.xzjgxg" nz-button nzType="primary" [disabled]='!fs.er.airport' (click)="fs.save()" [nzLoading]="fs.isSaveing">保存</button>
          </div>
        </div>
      </form>
    </nz-modal>
  </div>
</div>
